<?php
declare (strict_types = 1);

namespace app\command;

use think\console\Command;
use think\console\Input;
use think\console\input\Argument;
use think\console\input\Option;
use think\console\Output;

use Workerman\Crontab\Crontab;
use Workerman\Worker;

class User extends Command
{
    protected function configure()
    {
        // 指令配置
        $this->setName('user')
            ->setDescription('the user command');
    }

    protected function execute(Input $input, Output $output)
    {

        $worker = new Worker();
        $worker->onWorkerStart = function () {
            // Execute the function in the first second of every minute.
            new Crontab('1 * * * * *', function(){
                echo date('Y-m-d H:i:s')."\n";
            });
        };
        Worker::runAll();
//        // 指令输出
//        $output->writeln('user');
    }
}
